import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/table';
import { airportList } from '@apps/ant-bus/src/views/business/airport/data/api';
import { goodsList } from '@apps/ant-bus/src/views/business/goods/goods/api';
import { shopList } from '@apps/ant-bus/src/views/business/goods/shop/data/api';

export const columns: BasicColumn[] = [
  {
    title: '日期',
    dataIndex: 'startDate',
    width: 100,
  },
  {
    title: '地区',
    dataIndex: 'airportName',
    width: 100,
  },
  {
    title: '核销内容',
    dataIndex: 'serverName',
    width: 100,
  },
  {
    title: '核销员工',
    dataIndex: 'employeeName',
    width: 100,
  },
  {
    title: '店铺',
    dataIndex: 'targetName',
    width: 100,
  },
  {
    title: '核销商品',
    dataIndex: 'goodsName',
    width: 100,
  },
  {
    title: '数量',
    dataIndex: 'checkNum',
    width: 100,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'airportId',
    label: '地区',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: {
      api: airportList,
      labelField: 'airportName',
      valueField: 'airportId',
      immediate: true,
      showSearch: true,
    },
  },
  {
    field: 'goodsId',
    label: '商品',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: {
      api: goodsList,
      labelField: 'goodsName',
      valueField: 'goodsId',
      immediate: false,
      showSearch: true,
    },
  },
  {
    field: 'shopId',
    label: '店铺',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: {
      api: shopList,
      labelField: 'shopName',
      valueField: 'shopId',
      immediate: false,
      showSearch: true,
    },
  },
];
